package socket.decoder;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.FixedLengthFrameDecoder;

import java.util.List;

public class newFixedLength extends FixedLengthFrameDecoder {
    private int frameLength;
    public newFixedLength(int frameLength) {
        super(frameLength);
        if (frameLength <= 0) {
            throw new IllegalArgumentException("frameLength must be a positive integer: " + frameLength);
        }
        else if(frameLength == 25){
            System.out.println("哈哈哈");
        }
        else {
            this.frameLength = frameLength;
        }
    }
    protected void decodes(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        System.out.println("哈哈哈"+in.readInt());

    }
}
